package hua.mtreader.base;

import java.lang.ref.WeakReference;

/**
 * Created by Administrator on 2017/3/15.
 */

public class BasePresenter<T> {

    private WeakReference<T> mViewRef;


    public void attachView(T view){
        mViewRef = new WeakReference<T>(view);
    }

    public void detachView(){
        if (mViewRef != null) {
            mViewRef.clear();
        }
    }

    public T getView(){
        return mViewRef.get();
    }

}
